﻿<phone:PhoneApplicationPage x:Class="_1906Ultras.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="true" shell:SystemTray.Opacity="0"
    DataContext="{Binding Main, Source={StaticResource Locator}}">


    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <cmd:EventToCommand Command="{Binding LoadedCommand}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    
    
    <!--LayoutRoot contains the root grid where all other page content is placed-->
    <Grid x:Name="LayoutRoot">

        <controls:Pivot Title="{Binding ApplicationTitle}">

            <!--Panorama item one-->
            <controls:PivotItem Header="about">
                <ScrollViewer Margin="12,0,0,0">
                    <StackPanel>
                        <Image Source="/Img/logo-black.png"/>
                        <TextBlock TextWrapping="Wrap">
                            <LineBreak/>1906 Ultras are the main supporter group of the San Jose Earthquakes. We are an independent group of dedicated fans and we are in no way linked to the San Jose Earthquakes organization.
                            <LineBreak/>
                            <LineBreak/>Our goals are to improve the stadium atmosphere and to support our team during the whole game. We stand in section 109 at Buckshaw, and in section 113 at the Oakland Coliseum. We organize pre-game tailgates and away games viewing parties at different locations in the Bay Area. Currently, the group has about 200 members and is constantly growing.
                            <LineBreak/>
                            <LineBreak/><Run Foreground="Blue" FontWeight="Bold" FontSize="28">1906 Ultras History</Run>
                            <LineBreak/>
                            <LineBreak/><Run Foreground="Blue" FontWeight="Bold">San Jose Ultras</Run>
                            <LineBreak/>The San Jose Ultras occupied the South End and Section 135 of Spartan Stadium from 2003-2005. During the second leg of a playoff game against the rival Los Angeles Galaxy in which the Earthquakes were down 4-0, the Ultras unveiled a huge banner disclaiming: “Win or Lose, we will always be here for you!” The Earthquakes scored 5 goals to win 5-4, and the slogan became a rallying cry for the group.
                            <LineBreak/>
                            <LineBreak/>The activity of the group was interrupted between 2005 and 2007, when the team was relocated to Houston, under a different name. At the end of 2007, after MLS announced that the San Jose Earthquakes are back in the league, the Ultras reunited. They were joined by another Bay Area supporter group, called the 1906 Supporters.
                            <LineBreak/>
                            <LineBreak/><Run Foreground="Blue" FontWeight="Bold">1906 Supporters</Run>
                            <LineBreak/>The 1906 Supporters cheered on the California Victory in Section “Oi” of Kezar Stadium in San Francisco, California in 2007. The term “1906″ referred to the 1906 earthquake and fire of San Francisco. The 1906 Supporters had their roots in early fan support of the San Francisco Seals as well as the San Jose Earthquakes, who were on hiatus during the 2007 season. The Victory suspended operation in September 2007, and the 1906 Supporters decided to jointly support the Earthquakes with the San Jose Ultras and created the 1906 Ultras.
                        </TextBlock>
                        <Image Margin="24,24,24,24" Source="/Img/winorlose.png"/>

                    </StackPanel>
                </ScrollViewer>
            </controls:PivotItem>
            
            
            <controls:PivotItem Header="songs">
                <ScrollViewer Margin="12,0,0,0">
                <ListBox Name="songListBox" ItemsSource="{Binding SongList}" SelectedItem="{Binding SelectedSong, Mode=TwoWay}" VerticalAlignment="Top" ScrollViewer.VerticalScrollBarVisibility="Disabled">

                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Tap">
                            <cmd:EventToCommand Command="{Binding SongPageCommand, Mode=OneTime}"
                                                CommandParameter="{Binding SelectedItem, ElementName=songListBox}"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>

                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Border Padding="0,12" >
                                <StackPanel>
                                    <TextBlock Text="{Binding Title}" Foreground="Blue" FontSize="30" />
                                </StackPanel>
                            </Border>
                        </DataTemplate>

                    </ListBox.ItemTemplate>
                </ListBox>
                </ScrollViewer>
            </controls:PivotItem>

            <!--Pivot item two-->
            <controls:PivotItem Header="events">
                <ScrollViewer  Margin="12,0,0,0">
                <ListBox ItemsSource="{Binding Events}" Margin="0,0,-12,0" SelectedItem="{Binding SelectedEvent, Mode=TwoWay}"  VerticalAlignment="Top" ScrollViewer.VerticalScrollBarVisibility="Disabled">

                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Tap">
                            <cmd:EventToCommand Command="{Binding EventPageCommand, Mode=OneWay}"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>

                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Border Padding="0,0,0,22">
                                <StackPanel>
                                    <TextBlock Text="{Binding Name}" Foreground="Blue" FontSize="30" />
                                    <TextBlock Text="{Binding Preview}" FontSize="20" TextWrapping="Wrap"/>
                                </StackPanel>
                            </Border>
                        </DataTemplate>

                    </ListBox.ItemTemplate>
                </ListBox>
                </ScrollViewer>
            </controls:PivotItem>
            
            <controls:PivotItem Header="photos">
                <ScrollViewer Margin="12,0,0,0">
                        <ItemsControl Name="Thumbnails" ItemsSource="{Binding Photos}">
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <toolkit:WrapPanel />
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Button Style="{StaticResource ImageButton}" Click="ImageClick">
                                        <Button.Content>
                                            <StackPanel>
                                            <Image Source="{Binding ThumbLink}" Margin="3" Width="200" Height="200" Stretch="UniformToFill"/>
                                            </StackPanel>
                                        </Button.Content>
                                    </Button>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>

                        </ItemsControl>
                </ScrollViewer>
            </controls:PivotItem>


            <!-- twitter feed-->
            <controls:PivotItem Header="feed">
                <ScrollViewer>
                            
                    <StackPanel>
                        <ItemsControl ItemsSource="{Binding Tweets}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Border Padding="12">
                                        
                                        <toolkit:ContextMenuService.ContextMenu>
                                            <toolkit:ContextMenu IsZoomEnabled="False" >
                                                <toolkit:MenuItem Header="refresh" Command="{Binding Main.RefreshTweetsCommand, Source={StaticResource Locator}}" />
                                            </toolkit:ContextMenu>
                                        </toolkit:ContextMenuService.ContextMenu>
                                    
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="{Binding user.profile_image_url}" Margin="0,12,0,0" Height="80" Width="80" Stretch="UniformToFill" VerticalAlignment="Top"/>
                                            <Border Padding="12,0,0,0">
                                                <StackPanel>
                                                    <TextBlock Text="{Binding user.name}" Foreground="Blue" FontSize="30" />
                                                    <TextBlock Text="{Binding date_created}" FontSize="16"/>
                                                    <TextBlock Text="{Binding text}" FontSize="20" TextWrapping="Wrap" Width="320" />
                                                </StackPanel>
                                            </Border>
                                        </StackPanel>                                       
                                        
                                   </Border>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                        <TextBlock Text="more . . ." FontSize="32" Padding="20">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Tap">
                                    <cmd:EventToCommand Command="{Binding MoreTweetsCommand, Mode=OneWay}"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </TextBlock>
                    </StackPanel>
                </ScrollViewer>
            </controls:PivotItem>
        
        
        </controls:Pivot>
    </Grid>

    <!--Panorama-based applications should not show an ApplicationBar-->


</phone:PhoneApplicationPage>